import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkOrderTicketVO, ParkOrderTicketForm, ParkOrderTicketQuery } from '@/api/park/parkOrderTicket/types';

/**
 * 查询核销劵列表
 * @param query
 * @returns {*}
 */

export const listParkOrderTicket = (query?: ParkOrderTicketQuery): AxiosPromise<ParkOrderTicketVO[]> => {
  return request({
    url: '/park/parkOrderTicket/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询核销劵详细
 * @param ticketId
 */
export const getParkOrderTicket = (ticketId: string | number): AxiosPromise<ParkOrderTicketVO> => {
  return request({
    url: '/park/parkOrderTicket/' + ticketId,
    method: 'get'
  });
};

/**
 * 新增核销劵
 * @param data
 */
export const addParkOrderTicket = (data: ParkOrderTicketForm) => {
  return request({
    url: '/park/parkOrderTicket',
    method: 'post',
    data: data
  });
};

/**
 * 修改核销劵
 * @param data
 */
export const updateParkOrderTicket = (data: ParkOrderTicketForm) => {
  return request({
    url: '/park/parkOrderTicket',
    method: 'put',
    data: data
  });
};

/**
 * 删除核销劵
 * @param ticketId
 */
export const delParkOrderTicket = (ticketId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkOrderTicket/' + ticketId,
    method: 'delete'
  });
};
